import java.util.Arrays;

/**
 * @author tongchen
 * @create 2023-01-10 21:51
 */
public class Prime {
    public static void main(String[] args) {
        int[]nums=new int[11];
        int[]prime=new int[11];
        int count=0;
        for (int i = 2; i < nums.length ; i++) {
            //判断是否为素数
            if(nums[i]==0){
                prime[count++]=i;
            }
            //向后添加非素数
            for(int j=0;j<count&&i*prime[j]< nums.length;++j){
                nums[i*prime[j]]=1;
                if(i%prime[j]==0){
                    break;
                }
            }
        }
        System.out.println(Arrays.toString(prime));
    }
}
